package com.ls.code01;

/**
 * @author LS
 * @version 1.0
 * @description: 打印二进制
 * @date 2021/5/3 上午10:43
 */
public class Code01 {

    public static void print(int num) {
        for (int i = 31; i >= 0; i--) {
            System.out.print((num & (1 << i)) == 0 ? "0" : "1");
        }
    }

    public static void main(String[] args) {
        print(5);
        System.out.println();
        print(-5);
    }
}
